<?php
  #--------------------------------------------------
  # ALL INCLUDES + STANDARD-VALUES
  #--------------------------------------------------
  include_once("../include/author.php5");
  include_once("../include/config.inc");
  include_once("../include/template.inc");
  include_once("../include/class.db.php5");
  include_once("../include/class.tools.php5");
  include_once("../include/class.time.php5");
  $svo = new db("svoptik");
  $tools = new tool();
  $time = new TimeUtil();
  include_once("../include/global_fix_intern.inc");
  #--------------------------------------------------
  # CREATE TEMPLATE
  #--------------------------------------------------
  $t = new Template("templates", "keep");
  $t->set_file(array("page" => "svoptik.tpl",
                     "navi" => "navi.tpl"));
  #--------------------------------------------------


  #--------------------------------------------------
  # CREATE NAVIGATION RIGHT
  #--------------------------------------------------
  $links = "";
  $url[0] = array("URL" => "", "URL-TEXT" => "", "ONCLICK" => "", "TARGET" => "_self");
  for ($i=0; $i<count($url); $i++) {
     $links .= "
        <tr height=\"15\">
			<td valign=\"top\"><img src=\"../standard/spacer.gif\" width=\"20\" height=\"15\" border=\"0\" alt=\"\"></td>
			<td valign=\"top\"><a href=\"".$url[$i]['URL']."\" class=\"sitenav\" target=\"".$url[$i]['TARGET']."\" onClick=\"".$url[$i]['ONCLICK']."\">".$url[$i]['URL-TEXT']."</a></td>
			<td valign=\"top\"><img src=\"../standard/spacer.gif\" width=\"20\" height=\"15\" border=\"0\" alt=\"\"></td>
		</tr>
		<tr height=\"15\">
            <td colspan=\"3\"><img src=\"../standard/spacer.gif\" width=\"20\" height=\"15\" border=\"0\" alt=\"\"></td>
		</tr>
       ";
  }
  include_once("../member/standard/navi.php5");
  $t->set_var(array("LINKS" => $links, "BANNER" => $banner, "JSNAVI" => $js_navi));
  $right_nav = $t->parse("","navi", true);
  #--------------------------------------------------


  #--------------------------------------------------
  # CREATE CONTENT "MEMBERLIST"
  #--------------------------------------------------
  if ($usr_priv > 0) {
      $content = "
<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
	<tr>
		<td valign=\"top\" align=\"center\"><img src=\"../standard/spacer.gif\" width=\"10\" height=\"20\" border=\"0\" alt=\"\"></td>
	</tr>
	<tr>
		<td valign=\"top\" align=\"center\">
			<table width=\"500\" style=\"border: solid 1px #820400\" cellpadding=\"3\" cellspacing=\"0\">
  ";
      $sql = $svo->doSQL("select * from ".$table['Member']." order by MemberName asc, MemberVName asc;");
      $prev_letter = "";

      while ($tupel = $svo->getRecordset($sql)) {
          $mail = "&nbsp;";
          $datum = "&nbsp;";
          if (!empty($tupel['MemberMail'])) $mail = "<a href=\"mailto:".$tupel['MemberMail']."\" class=\"news\">".$tupel['MemberMail']."</a>";
          if (!empty($tupel['MemberGebDat'])) $datum = $time->out($tupel['MemberGebDat'], "d");

          if ($prev_letter != strtoupper(substr($tupel['MemberName'],0,1))) {
              $content .= "
              <tr>
                  <td align=\"left\" class=\"text\">&nbsp;&nbsp;<b>".strtoupper(substr($tupel['MemberName'],0,1))."</b></td>
              </tr>
              ";
          }
          $content .= "
				<tr>
					<td align=\"center\">
						<table width=\"480\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\">
							<tr>
								<td width=\"33%\" valign=\"top\" class=\"text\">".$tools->html_replace($tupel['MemberName']).", ".$tools->html_replace($tupel['MemberVName'])."</td>
                                <td width=\"67%\" valign=\"top\" class=\"text\">".$tools->html_replace($tupel['MemberStr'])."<br>".$tools->html_replace($tupel['MemberPLZ'])." ".$tools->html_replace($tupel['MemberOrt'])."</td>
                            </tr>
                            <tr>
                                <td valign=\"top\" class=\"text\">&nbsp;</td>
                                <td valign=\"top\" class=\"text\">
                                    Telefon: ".$tools->html_replace($tupel['MemberTel'])."<br>
                                    Mobil: ".$tools->html_replace($tupel['MemberMob'])."<br>
                                    E-Mail: ".$mail."<br>
                                    Geb.-Datum: ".$datum."
                                </td>
							</tr>
						</table>
					</td>
				</tr>
              ";
          $prev_letter = strtoupper(substr($tupel['MemberName'],0,1));
      }
      $content .= "
			</table>
		</td>
	</tr>
</table>
      ";
  } else $content = "
  <script language=\"javascript\">
  <!--
  alert('Du besitzt leider nicht die erforderlichen Rechte,\\num diese Seite anzeigen zu lassen!');
  window.location.replace('index.php5');
  //-->
  </script>
  ";
  #--------------------------------------------------

  #--------------------------------------------------
  # PARSE & OUTPUT
  #--------------------------------------------------
  $t->set_var(array("sitenav" => "MEMBERAREA -> LISTE ALLER MITGLIEDER",
                    "content" => $content."<br>",
                    "navi" => $right_nav));

  $t->parse("ALL", "page", true);
  $t->p("ALL");
?>
